package com.jiangroom.service;

import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @ClassName RabbitProducer
 * @Description TODO
 * @Author chen.pian
 * @Date 2019/8/16 10:03
 **/
@Component
public class RabbitProducer {
    @Autowired
    private AmqpTemplate rabbitTemplate;

    public void stringSend() {
        Date date = new Date();
        String dateString = new SimpleDateFormat("yyyy-mm-dd hh:MM:ss").format(date);
        this.rabbitTemplate.convertAndSend("fanoutExchange",null, dateString);
    }
}
